﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>操作员管理</title>
     <script src="../../Scripts/jquery-1.9.1.js" type="text/javascript"></script>
    <script src="../../Content/JS/layer-v1.7.1/layer/layer.js" type="text/javascript"></script>
    <link href="../../Content/Themes/blue2/css.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
     .show_operator{ width:650px; height:100%; margin:0px auto;}
     .show_Table{width:650px; border-color:#1C1C1C; overflow:scroll;text-align:center;border-collapse:collapse; border-spacing:0; margin-bottom:10px;  margin-top:5px;}
      .show_Table th,td{ word-break:keep-all; white-space:nowrap;  border:1px black solid ; padding:3px; }
      .clickColor{ background-color:#bed3ef;color:#5291E2;font-weight:bold; }
      .show_btn{ margin-top:11px; text-align:right; }
    </style>
</head>
<body class="main">
     <div class="AllWebTopDiv">
        <div class="path">
            <div class="nav">
                <a href="#">操作员管理</a>

            </div>
        </div>
        <div class="content">
         <div class="show_operator">
         <div class="show_btn">
            <input  type="button" value="添加用户" class="button2" onclick="addOperator()"/> 
            <input  type="button" value="关闭" id="btn_cancel" onclick="closeWindows();"  class="button2"/>
           </div>
           <table class="show_Table">
            <tr class="DGHeaderStyle">
             <th>序号</th>
             <th>用户名</th>
             <th>姓名</th>
             <th>性别</th>
             <th>电话</th>
             <th>角色</th>
             <th>操作</th>
             </tr>

           </table>
         </div>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
 window.onload=function() {  $.ajax({
                type:"POST",
                url:"<%:Url.Action("Load","Operator") %>",
                data:"",
                cache:false,
                success:function(txt)
                {
                  $(".show_Table").append(txt); 
                }
            })
            }

            //编辑角色
    function  editRole(o){ 
          $.layer({
                        type: 2,
                        title: false,
                        closeBtn:false,
                       shadeClose: true, //开启点击遮罩关闭层
                        move: ['.juanmove', true],
                       area: ['690px', '340px'],
                       offset: ['100px', ''],
                       iframe: { src: '/Operator/editRole/?id='+o},
                         success:function(){
                           layer.shift('top',500);
                                  }
                     });
    }
      //新增角色
           function addOperator(){
               $.layer({
                        type: 2,
                        title: false,
                        closeBtn:false,
                       shadeClose: true, //开启点击遮罩关闭层
                        move: ['.juanmove', true],
                       area: ['690px', '340px'],
                       offset: ['100px', ''],
                       iframe: { src: '<%:Url.Action("editRole","Operator") %>'},
                         success:function(){
                           layer.shift('top',500);
                                  }
                     });
           
     }
      
     //删除角色
     function delOperator(o){
         
        $.layer({
                  shade:[0.5,'#000',true],
                  area:['310px', '130px'],
                  dialog:{
                      msg:'您确定要删除该角色吗',
                      btns:2,
                      type:4,
                      btn: ['确定','取消'],
                      yes:function(){
                          $.ajax({
                             type:"POST",
                              url:"<%:Url.Action("delRole","Operator") %>",
                             data:"Id="+o+"",
                             cache:false,
                             success:function(txt){
                              layer.msg(txt,2,function(){location.reload('<%:Url.Action("Operator","Operator") %>');});
                                 }
                            })

                      },no:function(){
                         layer.closeAll();
                      }
                  }
              
              });
     
     }

            //选择行
        var Id="";
      function selectRole(o){
          $(".show_Table tr").each(
                 function(){
                   var id=$(this).children("td").eq(0).text();
                    var parseId=parseFloat(id);
                    if(parseId==o){
                       Id=id;
                       $(this).children().addClass("clickColor");
                    }
                    else{
                     $(this).children().removeClass("clickColor");
                    }
                    
                 }
          );
      }
       //关闭窗口
    function closeWindows() {
        window.location.href = "/Loading/Index/?src=/Desktop/Index/";
    }
</script>
